#include<iostream>
#include<unordered_map>
#include<vector>


using namespace std;


vector<int> twoSum(vector<int>& nums, int target) {
    unordered_map<int, int> hash;

    for (int i = 0; i < nums.size(); i++)
    {
        hash[nums[i]] = i;
    }

    for (int i = 0; i < nums.size(); i++)
    {
        int val = target - nums[i];
        if (hash.count(val) && hash[val] != i) return {i ,hash[nums[val]]};
    }
    return {};
}

int main()
{
	unordered_map<int, int> hash;

    vector<int> nums = { 2,7,11,15 };
    vector<int> ret = twoSum(nums, 9);
    for (auto e : ret)
    {
        cout << e;
    }

	return 0;
}